//
//  CustomNavigationViewController.m
//  MusicTailor
//
//  Created by dl on 2018/11/17.
//  Copyright © 2018 com.li.ding. All rights reserved.
//

#import "CustomNavigationViewController.h"
#import "UIFont+NWWeight.h"
#import "UIColor+NWHex.h"
#import <Masonry/Masonry.h>

@interface CustomNavigationViewController ()

@end

@implementation CustomNavigationViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationBar.titleTextAttributes = @{
        NSForegroundColorAttributeName:[UIColor whiteColor],
        NSFontAttributeName: [UIFont nw_systemFontOfSize:18 weight:NWFontWeightMedium]
    };
    self.navigationBar.barStyle = UIBarStyleDefault;
    self.navigationBar.translucent = true;
    [self.navigationBar setBarTintColor:[UIColor clearColor]];
    self.navigationBar.tintColor = [UIColor whiteColor];
    self.navigationBar.shadowImage = [UIImage new];
    [self.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
    
    self.navigationBar.backgroundColor = [UIColor clearColor];
}

- (UIStatusBarStyle)preferredStatusBarStyle {
    return [self.viewControllers.lastObject preferredStatusBarStyle];
}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
    [super pushViewController:viewController animated:animated];
    viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"btn_navbar_back_b_n"] style:UIBarButtonItemStylePlain target:self action:@selector(goBack:)];
    
}

- (void) goBack:(id)sender {
    [self popViewControllerAnimated:YES];
}

@end
